package com.ihcy.base.core;

/**
 * 业务异常
 */
public class ServerException extends RuntimeException {
    private String errorCode;

    public ServerException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.errorCode = exceptionEnum.getCode();
    }

    public ServerException(ExceptionEnum exceptionEnum, String params) {
        super(String.format(exceptionEnum.getMessage(), params));
        this.errorCode = exceptionEnum.getCode();
    }

    public ServerException(String code, String message) {
        super(message);
        this.errorCode = code;
    }

    public ServerException(String code, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = code;
    }

    public String getErrorCode() {
        return errorCode;
    }
}
